Fix the wasm substitute caching bug#64
Merged
librelois merged 2 commits intomoonbeam-polkadot-v0.9.40from Jul 27, 2023
Merged
Conversation
|
@rimbi please rebase the PR, it doesn't seem correct |
Author
|
sorry for the inconvenience, ready for review again @crystalin @nbaztec @librelois |
librelois
reviewed
Jul 27, 2023
| code_fetcher: &WrappedRuntimeCode((&code).into()), | ||
| heap_pages: None, | ||
| hash: Vec::new(), | ||
| hash, |
There was a problem hiding this comment.
Suggested change
| hash, | |
| hash: make_hash(&code), |
librelois
reviewed
Jul 27, 2023
| let substitutes = substitutes | ||
| .into_iter() | ||
| .map(|(block_number, code)| { | ||
| let mut hasher = DefaultHasher::new(); |
There was a problem hiding this comment.
Suggested change
| let mut hasher = DefaultHasher::new(); |
librelois
reviewed
Jul 27, 2023
| .into_iter() | ||
| .map(|(block_number, code)| { | ||
| let mut hasher = DefaultHasher::new(); | ||
| hasher.write(&code); |
There was a problem hiding this comment.
Suggested change
| hasher.write(&code); |
librelois
reviewed
Jul 27, 2023
| .map(|(block_number, code)| { | ||
| let mut hasher = DefaultHasher::new(); | ||
| hasher.write(&code); | ||
| let hash = hasher.finish().to_ne_bytes().to_vec(); |
There was a problem hiding this comment.
Suggested change
| let hash = hasher.finish().to_ne_bytes().to_vec(); |
librelois
approved these changes
Jul 27, 2023
noandrea
pushed a commit
that referenced
this pull request
Sep 5, 2023
Fix the wasm substitute caching bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix the wasm substitute caching bug.
When there exist multiple code substitutes in the spec, the used to keep only one. The current solution fixes this bug by creating a unique hash for each wasm blob.